<!DOCTYPE HTML />
<html>
<head>
    <title><?php echo $view['activity']['title']; ?></title>
    <?php include_once("common/common_js.php") ?>
</head>
<body>
<?php include_once("common/banner.php"); ?>
<div class="warpper">
    <?php include_once("common/header.php"); ?>
    <div class="al">
        <h3>活动详情</h3>

        <div class="content">
            <p>

            <h3>活动海报</h3>
            <img src='<?php echo $view['activity']['picture'] ?>'/>
            </p>
            <p>

            <h3>活动简介</h3>
            <?php echo $view['activity']['description'] ?>
            </p>
            <p>

            <h3>活动咨询热线</h3>
            <?php echo $view['activity']['tel'] ?>
            </p>
            <p>

            <h3>活动时间</h3><?php echo $view['activity']['startDate'] ?>
            -  <?php echo $view['activity']['endDate'] ?></p>
            <p>

            <p>

            <h3>已获得投票数量</h3>
            <?php echo $view['activity']['amount'];?>
            </p>
            <p>

            <h3>投票</h3></p>
            <a href='javascript:vote(<?php echo $view['activity']['activityId'];?>)'><img src='/images/vo.png'/></a>
            <!-- <input type="radio" onclick="vote('hao',<?php /*echo $view['activity']['activityId']; */?>)"
                   name="voteOption" value="hao">好<input
                onclick="vote('zhong',<?php /*echo $view['activity']['activityId']; */?>)" type="radio"
                name="voteOption"
                value="zhong">中<input onclick="vote('cha',<?php /*echo $view['activity']['activityId']; */?>)"
                                      type="radio"
                                      name="voteOption"
                                      value="cha">差-->
            </p>
            <p>

            <h3>留言</h3>

            <div class="content">
                <ul>
                    <?Php
                    $comment = $this->modules->Comment;
                    $comments = $comment->findByOperatorIdAndType($view['activity']['activityId'], 'ACTIVITY');
                    $count = 1;
                    foreach ($comments as $comment) {
                        ?>
                        <li><em>评论<?php echo $count; ?>: </em><?php echo $comment['content'] ?></li>
                        <?php
                        $count++;
                    } ?>
                </ul>
            </div>
            <div>
                <form id="form1" name="form1"
                      action="/index.php/comment/add" method="post">
                    <input type="hidden" name="backUrl"
                           value="/index.php/activities/show/<?php echo $view['activity']['activityId'] ?>"/>
                    <input type="hidden" name="operatorId" value="<?php echo $view['activity']['activityId'] ?>"/>
                    <input type="hidden" name="type" value="ACTIVITY"/>
                    <textarea rows="5" cols="10" name="content"></textarea>
                    <button type="button" onclick="add(<?php echo $view['activity']['activityId'] ?>)">提交留言</button>
                </form>

            </div>
            </p>


        </div>
    </div>
</div>
<script language="javascript">
    function vote(voteId) {
        $.get("/index.php/ajax/voteActivity", {"activityId":voteId}, function(data) {
            alert(data);
            return false;
        })
    }
    function add() {
        $.get("/index.php/ajax/isLogin", function(data) {
            if (data == 1) {
                $("#form1").submit();
            }
            else {
                alert('请先登录');
                return false;
            }
        })
    }
</script>

</body>
</html>